<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新增客户</title>
    <link href="./css/bootstrap.css" rel="stylesheet">
    <link href="./css/normalize.css" rel="stylesheet">
    <script src="./js/jquery.js"></script>
    <script src="./js/bootstrap.js"></script>
    <style>
        #head{
            margin-top: 25px;
        }
    </style>
    <script>
        $(function (){
            $("#comi").click(function (){
                let params = {
                    cName:$("#username").val(),
                    email:$("#email").val(),
                    cClassify:$("#cClassify").val(),
                    cSource:$("#clientSource").val(),
                    cInstury:$("#clientInstury").val(),
                    cNetAddress:$("#clientNetAddress").val(),
                    cContry:$("#clientContry").val(),
                    cCity:$("#clientCity").val(),
                    cAddress:$("#clientAddress").val(),
                    cCode:$("#clientCode").val(),
                    cFax:$("#clientFax").val(),
                    cLinkman:$("#clientLinkman").val(),
                    cDepartment:$("#clientDepartment").val(),
                    cPosition:$("#clientPosition").val(),
                    cPhone:$("#clientPhone").val(),
                    cLegalRepresent:$("#clientLegalRepresent").val(),
                    cRegistredCapital:$("#clientRegistredCapital").val(),
                    cInstruction:$("#clientInstruction").val(),
                    bankAccount:$("#bankAccount").val(),
                    acountName:$("#acountName").val(),
                    bank:$("#bank").val(),
                    bankAddress:$("#bankAddress").val(),
                    ein:$("#ein").val(),
                    bankPhone:$("#bankPhone").val()
                };
                $.ajax({
                    type: "POST",
                    url: "http://localhost:8080/customer/add",
                    data: {
                        param:JSON.stringify(params)
                    },
                    contentType:"application/x-www-form-urlencoded; charset=UTF-8",
                    dataType:"json",  <!--dataType:服务器返回的数据类型 text/xml/script/html/json/jsonp -->
                    success: function (result) {
                        if (result.status === 200) {
                            /**
                             * 添加成功 页面跳转回数据展示页面
                             */
                            alert("添加成功")
                            window.location.href = "listPage.html"
                        }
                    }
                })
            })
        })

        $(function (){
            $("#reflesh").click(function (){
                window.location.href = "listPage.html"
            })
        })
    </script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="clearfix" id="head" style="margin-bottom: 10px">
            <div class="pull-left">
                <p>
                    <span style="font-size: 16px;font-weight: bold">新增客户</span>
                </p>
            </div>
            <div class="pull-right">
                <button class="btn-info" id="reflesh">返回展示首页</button>
            </div>
        </div>
        <div style="background: #a6e1ec;border: solid 1px #bdb0b0;margin-bottom: 10px">
            <P>
                <span>基本信息</span>
            </P>
        </div>

        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>客户名称</span>
                <input id="username" type="text" name="username">
            </div>
            <div class="pull-right">
                <span>邮件/QQ</span>
                <input id="email" type="text" name="email">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>分类</span>
                <input id="cClassify" type="text" name="cClassify">
            </div>
            <div class="pull-right">
                <span>客户来源</span>
                <input id="clientSource" type="text" name="clientSource">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>所属行业</span>
                <input id="clientInstury" type="text" name="clientInstury">
            </div>
            <div class="pull-right">
                <span>客户网址</span>
                <input id="clientNetAddress" type="text" name="clientNetAddress">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>国家/地区</span>
                <input id="clientContry" type="text" name="clientContry">
            </div>
            <div class="pull-right">
                <span>所在城市</span>
                <input id="clientCity" type="text" name="clientCity">
            </div>
        </div>
        <div style="margin-bottom: 10px">
            <span>详细地址</span>
            <input id="clientAddress"type="text" name="clientAddress" style="">
        </div>

        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>联系人</span>
                <input id="clientLinkman" type="text" name="clientLinkman">
            </div>
            <div class="pull-right">
                <span>部门</span>
                <input id="clientDepartment" type="text" name="clientDepartment">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>职务</span>
                <input id="clientPosition" type="text" name="clientPosition">
            </div>
            <div class="pull-right">
                <span>移动电话</span>
                <input id="clientPhone" type="text" name="clientPhone">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>法人代表</span>
                <input id="clientLegalRepresent" type="text" name="clientLegalRepresent">
            </div>
            <div class="pull-right">
                <span>注册资本</span>
                <input id="clientRegistredCapital" type="text" name="clientRegistredCapital">
            </div>
        </div>
        <div  style="margin-bottom: 30px">
            <span>附加说明</span>
            <input id="clientInstruction" type="text" class="form-control input-large" name="clientInstruction">
        </div>

        <div style="background: #a6e1ec;border: solid 1px #bdb0b0;margin-bottom: 10px">
            <P>
                <span>财务信息</span>
            </P>
        </div>

        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>银行账号</span>
                <input id="bankAccount" type="text" name="bankAccount">
            </div>
            <div class="pull-right">
                <span>开户名称</span>
                <input id="acountName" type="text" name="acountName">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>开户银行</span>
                <input id="bank" type="text" name="bank">
            </div>
            <div class="pull-right">
                <span>银行地址</span>
                <input id="bankAddress" type="text" name="bankAddress">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>税号</span>
                <input id="ein" type="text" name="ein">
            </div>
            <div class="pull-right">
                <span>电话</span>
                <input id="bankPhone" type="text" name="bankPhone">
            </div>
        </div>


        <div style="margin-left: 50%;margin-top: 50px;margin-bottom: 50px">
            <button type="button" class="btn-default" id="comi">提交</button>
        </div>
    </div>
</div>

</body>
</html>